package com.truckdispatching.http.util;

import android.os.Handler;
import android.os.Message;

public abstract class OnResponseHandler extends Handler implements OnResponseListener {

	public static final int	SUCESS	= 1;
	public static final int	ERROR	= 2;

	@Override
	public void handleMessage(Message msg) {
		try {
			switch (msg.what) {
				case SUCESS: {
					onResponse(msg.obj);
					break;
				}
				case ERROR: {
					onResponseError(msg.arg1, msg.obj.toString());
					break;
				}
				default:
					break;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
